<HTML><HEAD> <!-- ------------- Radio Buttons ------------- --> <SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers /* THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com Copyright (c)1998 by Charles River Media. All Rights Reserved. This applet can only be re-used or modifed by license holders of the JavaScript Cookbook CD-ROM. Credit must be given in the source code and this copyright notice must be maintained. If you do not hold a license to the JavaScript Cookbook, you may NOT duplicate or modify this code for your own use. Use at your own risk. No warranty is given or implied of the suitability of this applet for any specific application. Neither Erica Sadun nor Charles River Media will be held responsible for any unwanted effects due to the use of this applet or any derivative. */ function pressed(aRadioButton) { alert("You pressed "+aRadioButton.value) } <!-- done hiding --></SCRIPT></HEAD> <BODY bgcolor="ffffff" link="0000ff" vlink="770077"> <FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50 ALIGN = LEFT>Radio Button Values</H1></FONT> <FONT COLOR="770000"><BLOCKQUOTE> This script uses onClick events to capture changing information about a radio button set. </BLOCKQUOTE></FONT> <FONT SIZE=4><CENTER><FORM> One:<INPUT TYPE="radio" NAME="myradio" VALUE="one" onClick="pressed(this)"> Two:<INPUT TYPE="radio" NAME="myradio" VALUE="two" onClick="pressed(this)"> Three:<INPUT TYPE="radio" NAME="myradio" VALUE="three" onClick="pressed(this)"> </FORM></CENTER></FONT> <FONT COLOR="007777"><H2>Discussion</H2></FONT> <FONT SIZE=4> When only one of a set of values may be valid, use radio buttons rather than a series of standard buttons. You don't have to store 'prior value', 'new value', etc. </FONT> <FONT COLOR="770000"><PRE> function pressed(aRadioButton) { alert("You pressed "+aRadioButton.value) } One:<INPUT TYPE="radio" NAME="myradio" VALUE="one" onClick="pressed(this)"> </PRE></FONT> <h5>Copyright ©1996 by Charles River Media, All Rights Reserved</h5> </BODY> </HTML>